package com.nbsaas.sample.user.rest.convert;

import com.nbsaas.sample.entity.user.Structure;
import com.nbsaas.sample.user.api.domain.request.StructureDataRequest;

import org.springframework.beans.BeanUtils;
import com.nbsaas.boot.rest.api.Converter;
import com.nbsaas.boot.utils.BeanDataUtils;
            import com.nbsaas.sample.entity.user.Structure;

/**
* 请求对象转换成实体对象
*/

public class StructureEntityConvert  implements Converter<Structure, StructureDataRequest> {
@Override
public Structure convert(StructureDataRequest source) {
Structure result = new Structure();
BeanDataUtils.copyProperties(source, result);
            if(source.getParent()!=null){
            Structure parent =new Structure();
            parent.setId(source.getParent());
            result.setParent(parent);
            }
return result;
}
}

